package com.stylefeng.guns.modular.bus.service.impl;

import com.stylefeng.guns.core.util.Config;
import com.stylefeng.guns.core.util.KaptchaUtil;
import com.stylefeng.guns.core.util.OSSUtil;
import com.stylefeng.guns.modular.bus.service.IBusPrdTraceService;
import com.stylefeng.guns.modular.system.model.BusPrdTrace;
import com.stylefeng.guns.modular.system.model.BusPrdTraceInfo;
import com.stylefeng.guns.modular.system.dao.BusPrdTraceInfoMapper;
import com.stylefeng.guns.modular.bus.service.IBusPrdTraceInfoService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author junz123
 * @since 2018-04-21
 */
@Service
public class BusPrdTraceInfoServiceImpl extends ServiceImpl<BusPrdTraceInfoMapper, BusPrdTraceInfo> implements IBusPrdTraceInfoService {
    @Resource
    BusPrdTraceInfoMapper busPrdTraceInfoMapper;
    @Resource
    IBusPrdTraceService busPrdTraceService;
    @Override
    public Map getPrdInfo4PrdId(String prdId) {
        Map<String,String> map=busPrdTraceInfoMapper.getPrdInfo4PrdId(prdId);
        map.put("comLogoFilePath", OSSUtil.getFileUrl(map.get("comLogFilename"), Config.expires));
        map.put("prdImgFilePath", OSSUtil.getFileUrl(map.get("prdImgFilename"), Config.expires));
        return map;
    }

    @Override
    public Map getPrdInfo4PrdNo(String prdNo) {
        Map<String,String> map=busPrdTraceInfoMapper.getPrdInfo4PrdNo(prdNo);
        map.put("comLogoFilePath", OSSUtil.getFileUrl(map.get("comLogFilename"), Config.expires));
        map.put("prdImgFilePath", OSSUtil.getFileUrl(map.get("prdImgFilename"), Config.expires));
        return map;
    }

    @Override
    public List<BusPrdTraceInfo> selectTraceList4Com(Map map) {
        List<BusPrdTraceInfo> list=busPrdTraceInfoMapper.selectTraceList4Com(map);
        return list;
    }
    @Override
    public List<BusPrdTraceInfo> selectTraceInfo(Map map) {
        return busPrdTraceInfoMapper.selectTraceInfo(map);
    }
}
